<include file="Public/sui_header" />
<div class="bar bar-header-secondary" style="top:0;">
  <div class="searchbar">
    <a class="searchbar-cancel">取消</a>
    <div class="search-input">
      <label class="icon icon-search" for="search"></label>
      <form action="__MODULE__/funding/list" method="get">
        <input type="search" id='searchMap[name]' name='searchMap[name]' placeholder='输入关键字...' style="padding-left: 1.5rem;" />
      </form>
    </div>
  </div>
</div>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/swipe/css/swipe.css">
<div class="addWrap" style="margin-top: 2.2rem;">
    <div class="swipe" id="mySwipe">
        <div class="swipe-wrap">
            <volist name="ad" id="vo">
                <div>
                    <a href="{$vo['href']}"><img class="img-responsive" src="__PUBLIC__/file/{$vo['picture']}" /></a>
                </div>
            </volist>
        </div>
    </div>
    <ul id="position">
        <volist name="ad" id="vo">
            <li <if condition="$i eq 1"> class="cur" </if> ></li>
        </volist>
    </ul>
</div>
<script src="__PUBLIC__/swipe/js/swipe.js"></script>
<script type="text/javascript">
var bullets = document.getElementById('position').getElementsByTagName('li');
var banner = Swipe(document.getElementById('mySwipe'), {
    auto: 2000,
    continuous: true,
    disableScroll: false,
    callback: function(pos) {
        var i = bullets.length;
        while (i--) {
            bullets[i].className = ' ';
        }
        bullets[pos].className = 'cur';
    }
});
</script>
<div style="font-size:1.2em;margin-top:0.5rem;">
    <span class="color-block">&nbsp;</span>&nbsp;当前位置：<span id="address">获取中...</span>
</div>
<script type="text/javascript">
    function Location(){};
Location.prototype.getLocation = function(callback){
  var options = {
    enableHighAccuracy: true,
    maximumAge: 1000
  };
  this.callback = Object.prototype.toString.call(callback) =="[object Function]" ?
    callback : 
    function(address){
      // alert(address.province + address.city);
      console.log("getocation(callbackFunction) 可获得定位信息对象");
    };
  var self = this;
  if (navigator.geolocation) {
    //浏览器支持geolocation
    navigator.geolocation.getCurrentPosition(function(position){
      //经度
      var longitude = position.coords.longitude;
      //纬度
      var latitude = position.coords.latitude;
      self.loadMapApi(longitude,latitude);
    }, self.onError, options);
  } else {
    //浏览器不支持geolocation
  }
};
Location.prototype.loadMapApi = function(longitude, latitude){
  var self = this;
  var oHead = document.getElementsByTagName('HEAD').item(0);
  var oScript= document.createElement("script");
  oScript.type = "text/javascript";
  oScript.src="http://api.map.baidu.com/getscript?v=2.0&ak=A396783ee700cfdb9ba1df281ce36862&services=&t=20140930184510";
  oHead.appendChild(oScript);
  oScript.onload = function(date){
    var point = new BMap.Point(longitude, latitude);
    var gc = new BMap.Geocoder();
    gc.getLocation(point, function(rs) {
      var addComp = rs.addressComponents;
      self.callback(addComp);
    });
  }
};
Location.prototype.onError = function(error) {
  switch (error.code) {
    case 1:
      // alert("位置服务被拒绝");
      break;
    case 2:
      // alert("暂时获取不到位置信息");
      break;
    case 3:
      // alert("获取信息超时");
      break;
    case 4:
      // alert("未知错误");
      break;
  }
};
//调用
var local = new Location();
local.getLocation(function(res){
    $('#address').html(res.city);
})
</script>
<div style="font-size:1.2em;margin-top:0.5rem;">
    <span class="color-block">&nbsp;</span>&nbsp;热门目的地
</div>
<volist name="destinationFunding" id="vo">
    <div class="card">
        <div class="card-header">
            <span class="icon icon-friends"></span> {:D('FundingType')->where(['id'=>$vo['funding_type']])->find()['long_name']}
        </div>
        <div class="card-content">
            <div class="card-content-inner">
                <a href="{:U('Funding/detail', ['id'=>$vo['id']])}">
                    <img class="list-img" src="__PUBLIC__/file/{$vo['img']}" />
                    <div class="list-name-div">
                        <span class="list-name">{$vo['name']}</span>
                    </div>
                    <div class="list-info">
                        <span class="list-info-item"><span class="icon icon-app"></span> {$vo['funding_price']} 元</span>
                        <br/>
                        <span class="list-info-item"><span class="icon icon-friends"></span> {$vo['already_num']}/{$vo['total_num']}人参与</span>
                    </div>
                </a>
                <!--
                <div class="list-desc">
                    {$vo['detail_wap']|html_entity_decode}
                </div>
                -->
            </div>
        </div>
        <div class="card-footer">
            <a href="{:U('Funding/buy', ['id'=>$vo['id']])}" class="button"><span class="icon icon-star"></span> 立即参加</a>
            <a href="{:U('Funding/detail', ['id'=>$vo['id']])}" class="button"><span class="icon icon-search"></span> 查看详情</a>
        </div>
    </div>
</volist>
<div style="font-size:1.2em;margin-top:0.5rem;">
    <span class="color-block">&nbsp;</span>&nbsp;热门筹单
</div>
<volist name="hotFunding" id="vo">
    <div class="card">
        <div class="card-header">
            <span class="icon icon-friends"></span> {:D('FundingType')->where(['id'=>$vo['funding_type']])->find()['long_name']}
        </div>
        <div class="card-content">
            <div class="card-content-inner">
                <a href="{:U('Funding/detail', ['id'=>$vo['id']])}">
                    <img class="list-img" src="__PUBLIC__/file/{$vo['img']}" />
                    <div class="list-name-div">
                        <span class="list-name">{$vo['name']}</span>
                    </div>
                    <div class="list-info">
                        <span class="list-info-item"><span class="icon icon-app"></span> {$vo['funding_price']} 元</span>
                        <br/>
                        <span class="list-info-item"><span class="icon icon-friends"></span> {$vo['already_num']}/{$vo['total_num']}人参与</span>
                    </div>
                </a>
                <!--
                <div class="list-desc">
                    {$vo['detail_wap']|html_entity_decode}
                </div>
                -->
            </div>
        </div>
        <div class="card-footer">
            <a href="{:U('Funding/buy', ['id'=>$vo['id']])}" class="button"><span class="icon icon-star"></span> 立即参加</a>
            <a href="{:U('Funding/detail', ['id'=>$vo['id']])}" class="button"><span class="icon icon-search"></span> 查看详情</a>
        </div>
    </div>
</volist>
<div style="font-size:1.2em;margin-top:0.5rem;">
    <span class="color-block">&nbsp;</span>&nbsp;天天优惠
</div>
<volist name="discountFunding" id="vo">
    <div class="card">
        <div class="card-header">
            <span class="icon icon-friends"></span> {:D('FundingType')->where(['id'=>$vo['funding_type']])->find()['long_name']}
        </div>
        <div class="card-content">
            <div class="card-content-inner">
                <a href="{:U('Funding/detail', ['id'=>$vo['id']])}">
                    <img class="list-img" src="__PUBLIC__/file/{$vo['img']}" />
                    <div class="list-name-div">
                        <span class="list-name">{$vo['name']}</span>
                    </div>
                    <div class="list-info">
                        <span class="list-info-item"><span class="icon icon-app"></span> {$vo['funding_price']} 元</span>
                        <br/>
                        <span class="list-info-item"><span class="icon icon-friends"></span> {$vo['already_num']}/{$vo['total_num']}人参与</span>
                    </div>
                </a>
                <!--
                <div class="list-desc">
                    {$vo['detail_wap']|html_entity_decode}
                </div>
                -->
            </div>
        </div>
        <div class="card-footer">
            <a href="{:U('Funding/buy', ['id'=>$vo['id']])}" class="button"><span class="icon icon-star"></span> 立即参加</a>
            <a href="{:U('Funding/detail', ['id'=>$vo['id']])}" class="button"><span class="icon icon-search"></span> 查看详情</a>
        </div>
    </div>
</volist>
<include file="Public/sui_footer" />
